package com.zywl.utils.utils.enums;

import com.zywl.utils.utils.Constants;

public enum ResTypeEnum {
    MENU("1", "菜单"), BUTTON("2", "按钮");

    private final String key;
    private final String value;

    ResTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static String getValueByKey(String key) {
        for (ResTypeEnum en : ResTypeEnum.values()) {
            if (en.getKey().equals(key)) {
                return en.getValue();
            }
        }
        return Constants.STRING_NULL;
    }

    public static String getKeyByValue(String value) {
        for (ResTypeEnum en : ResTypeEnum.values()) {
            if (en.getValue().equalsIgnoreCase(value)) {
                return en.getKey();
            }
        }
        return Constants.STRING_NULL;
    }
}
